package cn.wl.crm.web.controller;

import cn.wl.PageList;
import cn.wl.crm.domain.ReturnCar;
import cn.wl.crm.query.ReturnCarQuery;
import cn.wl.crm.service.IReturnCarService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@Controller
@RequestMapping("/returnCar")
@Api(tags = "还车")
@CrossOrigin
public class ReturenCarController {
    @Autowired
    private IReturnCarService returnCarService;

    @RequestMapping(value = "/list",method = RequestMethod.PATCH)
    @ResponseBody
    @ApiResponses({
            @ApiResponse(code=200,message="成功"),
            @ApiResponse(code=500,message="服务器错误")
    })
    public List<ReturnCar> queryAll(){
        return returnCarService.queryAll();

    }
    //分页查询方法
    @RequestMapping(value = "/queryPage",method = RequestMethod.PATCH)
    @ResponseBody
    @ApiResponses({
            @ApiResponse(code=200,message="成功"),
            @ApiResponse(code=500,message="服务器错误")
    })
    @CrossOrigin
    public PageList queryPage(@RequestBody ReturnCarQuery returnCarQuery){
        return returnCarService.queryPage(returnCarQuery);
    }


}
